// generated 2005/6/24 0:15:11 CST by xihels@163.com
//
#ifndef _LOGINDIALOG_HH
#  define _LOGINDIALOG_HH

#if !defined(GLADEMM_DATA)
#define GLADEMM_DATA 
#include <gtkmm/accelgroup.h>

class GlademmData
{  

    Glib::RefPtr<Gtk::AccelGroup> accgrp;
    public:

    GlademmData(Glib::RefPtr<Gtk::AccelGroup> ag) : accgrp(ag)
    {  
    }

    Glib::RefPtr<Gtk::AccelGroup>  getAccelGroup()
    {  return accgrp;
    }
};
#endif //GLADEMM_DATA

#include <gtkmm/window.h>
#include <gtkmm/button.h>
#include <gtkmm/comboboxentrytext.h>
#include <gtkmm/entry.h>
#include <gtkmm/checkbutton.h>
#include <gtkmm/box.h>

#include "QQUser.h"
#include <list>
using std::list;

#include <functional>
using std::unary_function;

class MainWindow;
class LoginWindow : public Gtk::Window
{  
    public:	
	typedef list<QQUser> USERS;
	USERS users;
		
	LoginWindow(MainWindow& _parent);
	~LoginWindow();

	QQUser getUser();
    private:
	bool on_delete_event(GdkEventAny*);
	void on_account_changed();
	void on_passwd_changed();

	void loadUsersList();
	void saveUsersList(int);
	void Gui2User(USERS::iterator iter);
	void User2Gui(USERS::iterator iter);

    private:


	struct compare : public unary_function < USERS::value_type ,bool> {
	    compare(int _id) : 
		id(_id)
	    {}
	    bool operator ()(USERS::value_type& val)
	    {
		return id == val.getUid();
	    }
	    int id;
	};
	
	GlademmData *gmm_data;
	Gtk::Button * buttonConnect;
	Gtk::ComboBoxEntryText * comboAccount;
	Gtk::Entry * entryPasswd;
	Gtk::CheckButton * checkHide;
	Gtk::CheckButton * checkRememberPassword;
	Gtk::CheckButton * checkTcp;

	sigc::connection passwdChangeConnect;
	
	MainWindow& parent;
	bool passwdChange;
};

#endif
